// Add sldl codes from Census using district names in Klarner 2012

// source: Census Gazeteer, 2010 and 2014
// https://www.census.gov/geographies/reference-files/time-series/geo/gazetteer-files.2014.html#list-tab-264479560

// note: called in statelegislators.do


// code created in sldlcodes_gazeteer.xls

replace sldlname=sldlname+" District" if  fstate==25

replace sldlname="Barnstable, Dukes & Nantucket District" if sldlname=="Barnstable Dukes & Nantucket District"



replace sldlname=subinstr(sldlname,"Thirty-Seventh","37th",.) if (year==2012 | year==2017) & fstate==25
replace sldlname=subinstr(sldlname,"Thirty-Sixth","36th",.) if (year==2012 | year==2017) & fstate==25
replace sldlname=subinstr(sldlname,"Thirty-Fifth","35th",.) if (year==2012 | year==2017) & fstate==25
replace sldlname=subinstr(sldlname,"Thirty-Fourth","34th",.) if (year==2012 | year==2017) & fstate==25
replace sldlname=subinstr(sldlname,"Thirty-Third","33rd",.) if (year==2012 | year==2017) & fstate==25
replace sldlname=subinstr(sldlname,"Thirty-Second","32nd",.) if (year==2012 | year==2017) & fstate==25
replace sldlname=subinstr(sldlname,"Thirty-First","31st",.) if (year==2012 | year==2017) & fstate==25
replace sldlname=subinstr(sldlname,"Thirtieth","30th",.) if (year==2012 | year==2017) & fstate==25
replace sldlname=subinstr(sldlname,"Twenty-Ninth","29th",.) if (year==2012 | year==2017) & fstate==25
replace sldlname=subinstr(sldlname,"Twenty-Eighth","28th",.) if (year==2012 | year==2017) & fstate==25
replace sldlname=subinstr(sldlname,"Twenty-Seventh","27th",.) if (year==2012 | year==2017) & fstate==25
replace sldlname=subinstr(sldlname,"Twenty-Sixth","26th",.) if (year==2012 | year==2017) & fstate==25
replace sldlname=subinstr(sldlname,"Twenty-Fifth","25th",.) if (year==2012 | year==2017) & fstate==25
replace sldlname=subinstr(sldlname,"Twenty-Fourth","24th",.) if (year==2012 | year==2017) & fstate==25
replace sldlname=subinstr(sldlname,"Twenty-Third","23rd",.) if (year==2012 | year==2017) & fstate==25
replace sldlname=subinstr(sldlname,"Twenty-Second","22nd",.) if (year==2012 | year==2017) & fstate==25
replace sldlname=subinstr(sldlname,"Twenty-First","21st",.) if (year==2012 | year==2017) & fstate==25
replace sldlname=subinstr(sldlname,"Twentieth","20th",.) if (year==2012 | year==2017) & fstate==25
replace sldlname=subinstr(sldlname,"Nineteenth","19th",.) if (year==2012 | year==2017) & fstate==25
replace sldlname=subinstr(sldlname,"Eighteenth","18th",.) if (year==2012 | year==2017) & fstate==25
replace sldlname=subinstr(sldlname,"Seventeenth","17th",.) if (year==2012 | year==2017) & fstate==25
replace sldlname=subinstr(sldlname,"Sixteenth","16th",.) if (year==2012 | year==2017) & fstate==25
replace sldlname=subinstr(sldlname,"Fifteenth","15th",.) if (year==2012 | year==2017) & fstate==25
replace sldlname=subinstr(sldlname,"Fourteenth","14th",.) if (year==2012 | year==2017) & fstate==25
replace sldlname=subinstr(sldlname,"Thirteenth","13th",.) if (year==2012 | year==2017) & fstate==25
replace sldlname=subinstr(sldlname,"Twelfth","12th",.) if (year==2012 | year==2017) & fstate==25
replace sldlname=subinstr(sldlname,"Eleventh","11th",.) if (year==2012 | year==2017) & fstate==25
replace sldlname=subinstr(sldlname,"Tenth","10th",.) if (year==2012 | year==2017) & fstate==25
replace sldlname=subinstr(sldlname,"Ninth","9th",.) if (year==2012 | year==2017) & fstate==25
replace sldlname=subinstr(sldlname,"Eighth","8th",.) if (year==2012 | year==2017) & fstate==25
replace sldlname=subinstr(sldlname,"Seventh","7th",.) if (year==2012 | year==2017) & fstate==25
replace sldlname=subinstr(sldlname,"Sixth","6th",.) if (year==2012 | year==2017) & fstate==25
replace sldlname=subinstr(sldlname,"Fifth","5th",.) if (year==2012 | year==2017) & fstate==25
replace sldlname=subinstr(sldlname,"Fourth","4th",.) if (year==2012 | year==2017) & fstate==25
replace sldlname=subinstr(sldlname,"Third","3rd",.) if (year==2012 | year==2017) & fstate==25
replace sldlname=subinstr(sldlname,"Second","2nd",.) if (year==2012 | year==2017) & fstate==25
replace sldlname=subinstr(sldlname,"First","1st",.) if (year==2012 | year==2017) & fstate==25

replace sldl="60" if sldlname=="1st Barnstable District" & fstate==25 & (year==2012 | year==2017)
replace sldl="61" if sldlname=="2nd Barnstable District" & fstate==25 & (year==2012 | year==2017)
replace sldl="62" if sldlname=="3rd Barnstable District" & fstate==25 & (year==2012 | year==2017)
replace sldl="63" if sldlname=="4th Barnstable District" & fstate==25 & (year==2012 | year==2017)
replace sldl="64" if sldlname=="Barnstable, Dukes & Nantucket District" & fstate==25 & (year==2012 | year==2017)
replace sldl="65" if sldlname=="1st Berkshire District" & fstate==25 & (year==2012 | year==2017)
replace sldl="66" if sldlname=="2nd Berkshire District" & fstate==25 & (year==2012 | year==2017)
replace sldl="67" if sldlname=="3rd Berkshire District" & fstate==25 & (year==2012 | year==2017)
replace sldl="68" if sldlname=="4th Berkshire District" & fstate==25 & (year==2012 | year==2017)
replace sldl="69" if sldlname=="1st Bristol District" & fstate==25 & (year==2012 | year==2017)
replace sldl="70" if sldlname=="2nd Bristol District" & fstate==25 & (year==2012 | year==2017)
replace sldl="71" if sldlname=="3rd Bristol District" & fstate==25 & (year==2012 | year==2017)
replace sldl="72" if sldlname=="4th Bristol District" & fstate==25 & (year==2012 | year==2017)
replace sldl="73" if sldlname=="5th Bristol District" & fstate==25 & (year==2012 | year==2017)
replace sldl="74" if sldlname=="6th Bristol District" & fstate==25 & (year==2012 | year==2017)
replace sldl="75" if sldlname=="7th Bristol District" & fstate==25 & (year==2012 | year==2017)
replace sldl="76" if sldlname=="8th Bristol District" & fstate==25 & (year==2012 | year==2017)
replace sldl="77" if sldlname=="9th Bristol District" & fstate==25 & (year==2012 | year==2017)
replace sldl="78" if sldlname=="10th Bristol District" & fstate==25 & (year==2012 | year==2017)
replace sldl="79" if sldlname=="11th Bristol District" & fstate==25 & (year==2012 | year==2017)
replace sldl="80" if sldlname=="12th Bristol District" & fstate==25 & (year==2012 | year==2017)
replace sldl="81" if sldlname=="13th Bristol District" & fstate==25 & (year==2012 | year==2017)
replace sldl="82" if sldlname=="14th Bristol District" & fstate==25 & (year==2012 | year==2017)
replace sldl="83" if sldlname=="1st Essex District" & fstate==25 & (year==2012 | year==2017)
replace sldl="84" if sldlname=="2nd Essex District" & fstate==25 & (year==2012 | year==2017)
replace sldl="85" if sldlname=="3rd Essex District" & fstate==25 & (year==2012 | year==2017)
replace sldl="86" if sldlname=="4th Essex District" & fstate==25 & (year==2012 | year==2017)
replace sldl="87" if sldlname=="5th Essex District" & fstate==25 & (year==2012 | year==2017)
replace sldl="88" if sldlname=="6th Essex District" & fstate==25 & (year==2012 | year==2017)
replace sldl="89" if sldlname=="7th Essex District" & fstate==25 & (year==2012 | year==2017)
replace sldl="90" if sldlname=="8th Essex District" & fstate==25 & (year==2012 | year==2017)
replace sldl="91" if sldlname=="9th Essex District" & fstate==25 & (year==2012 | year==2017)
replace sldl="92" if sldlname=="10th Essex District" & fstate==25 & (year==2012 | year==2017)
replace sldl="93" if sldlname=="11th Essex District" & fstate==25 & (year==2012 | year==2017)
replace sldl="94" if sldlname=="12th Essex District" & fstate==25 & (year==2012 | year==2017)
replace sldl="95" if sldlname=="13th Essex District" & fstate==25 & (year==2012 | year==2017)
replace sldl="96" if sldlname=="14th Essex District" & fstate==25 & (year==2012 | year==2017)
replace sldl="97" if sldlname=="15th Essex District" & fstate==25 & (year==2012 | year==2017)
replace sldl="98" if sldlname=="16th Essex District" & fstate==25 & (year==2012 | year==2017)
replace sldl="99" if sldlname=="17th Essex District" & fstate==25 & (year==2012 | year==2017)
replace sldl="100" if sldlname=="1st Franklin District" & fstate==25 & (year==2012 | year==2017)
replace sldl="101" if sldlname=="2nd Franklin District" & fstate==25 & (year==2012 | year==2017)
replace sldl="102" if sldlname=="1st Hampden District" & fstate==25 & (year==2012 | year==2017)
replace sldl="103" if sldlname=="2nd Hampden District" & fstate==25 & (year==2012 | year==2017)
replace sldl="104" if sldlname=="3rd Hampden District" & fstate==25 & (year==2012 | year==2017)
replace sldl="105" if sldlname=="4th Hampden District" & fstate==25 & (year==2012 | year==2017)
replace sldl="106" if sldlname=="5th Hampden District" & fstate==25 & (year==2012 | year==2017)
replace sldl="107" if sldlname=="6th Hampden District" & fstate==25 & (year==2012 | year==2017)
replace sldl="108" if sldlname=="7th Hampden District" & fstate==25 & (year==2012 | year==2017)
replace sldl="109" if sldlname=="8th Hampden District" & fstate==25 & (year==2012 | year==2017)
replace sldl="110" if sldlname=="9th Hampden District" & fstate==25 & (year==2012 | year==2017)
replace sldl="111" if sldlname=="10th Hampden District" & fstate==25 & (year==2012 | year==2017)
replace sldl="112" if sldlname=="11th Hampden District" & fstate==25 & (year==2012 | year==2017)
replace sldl="113" if sldlname=="12th Hampden District" & fstate==25 & (year==2012 | year==2017)
replace sldl="114" if sldlname=="18th Essex District" & fstate==25 & (year==2012 | year==2017)
replace sldl="115" if sldlname=="1st Hampshire District" & fstate==25 & (year==2012 | year==2017)
replace sldl="116" if sldlname=="2nd Hampshire District" & fstate==25 & (year==2012 | year==2017)
replace sldl="117" if sldlname=="3rd Hampshire District" & fstate==25 & (year==2012 | year==2017)
replace sldl="118" if sldlname=="1st Middlesex District" & fstate==25 & (year==2012 | year==2017)
replace sldl="119" if sldlname=="2nd Middlesex District" & fstate==25 & (year==2012 | year==2017)
replace sldl="120" if sldlname=="3rd Middlesex District" & fstate==25 & (year==2012 | year==2017)
replace sldl="121" if sldlname=="4th Middlesex District" & fstate==25 & (year==2012 | year==2017)
replace sldl="122" if sldlname=="5th Middlesex District" & fstate==25 & (year==2012 | year==2017)
replace sldl="123" if sldlname=="6th Middlesex District" & fstate==25 & (year==2012 | year==2017)
replace sldl="124" if sldlname=="7th Middlesex District" & fstate==25 & (year==2012 | year==2017)
replace sldl="125" if sldlname=="8th Middlesex District" & fstate==25 & (year==2012 | year==2017)
replace sldl="126" if sldlname=="9th Middlesex District" & fstate==25 & (year==2012 | year==2017)
replace sldl="127" if sldlname=="10th Middlesex District" & fstate==25 & (year==2012 | year==2017)
replace sldl="128" if sldlname=="11th Middlesex District" & fstate==25 & (year==2012 | year==2017)
replace sldl="129" if sldlname=="12th Middlesex District" & fstate==25 & (year==2012 | year==2017)
replace sldl="130" if sldlname=="13th Middlesex District" & fstate==25 & (year==2012 | year==2017)
replace sldl="131" if sldlname=="14th Middlesex District" & fstate==25 & (year==2012 | year==2017)
replace sldl="132" if sldlname=="15th Middlesex District" & fstate==25 & (year==2012 | year==2017)
replace sldl="133" if sldlname=="16th Middlesex District" & fstate==25 & (year==2012 | year==2017)
replace sldl="134" if sldlname=="17th Middlesex District" & fstate==25 & (year==2012 | year==2017)
replace sldl="135" if sldlname=="18th Middlesex District" & fstate==25 & (year==2012 | year==2017)
replace sldl="136" if sldlname=="19th Middlesex District" & fstate==25 & (year==2012 | year==2017)
replace sldl="137" if sldlname=="20th Middlesex District" & fstate==25 & (year==2012 | year==2017)
replace sldl="138" if sldlname=="21st Middlesex District" & fstate==25 & (year==2012 | year==2017)
replace sldl="139" if sldlname=="22nd Middlesex District" & fstate==25 & (year==2012 | year==2017)
replace sldl="140" if sldlname=="23rd Middlesex District" & fstate==25 & (year==2012 | year==2017)
replace sldl="141" if sldlname=="24th Middlesex District" & fstate==25 & (year==2012 | year==2017)
replace sldl="142" if sldlname=="25th Middlesex District" & fstate==25 & (year==2012 | year==2017)
replace sldl="143" if sldlname=="26th Middlesex District" & fstate==25 & (year==2012 | year==2017)
replace sldl="144" if sldlname=="27th Middlesex District" & fstate==25 & (year==2012 | year==2017)
replace sldl="145" if sldlname=="28th Middlesex District" & fstate==25 & (year==2012 | year==2017)
replace sldl="146" if sldlname=="29th Middlesex District" & fstate==25 & (year==2012 | year==2017)
replace sldl="147" if sldlname=="30th Middlesex District" & fstate==25 & (year==2012 | year==2017)
replace sldl="148" if sldlname=="31st Middlesex District" & fstate==25 & (year==2012 | year==2017)
replace sldl="149" if sldlname=="32nd Middlesex District" & fstate==25 & (year==2012 | year==2017)
replace sldl="150" if sldlname=="33rd Middlesex District" & fstate==25 & (year==2012 | year==2017)
replace sldl="151" if sldlname=="34th Middlesex District" & fstate==25 & (year==2012 | year==2017)
replace sldl="152" if sldlname=="35th Middlesex District" & fstate==25 & (year==2012 | year==2017)
replace sldl="153" if sldlname=="36th Middlesex District" & fstate==25 & (year==2012 | year==2017)
replace sldl="154" if sldlname=="37th Middlesex District" & fstate==25 & (year==2012 | year==2017)
replace sldl="155" if sldlname=="18th Worcester District" & fstate==25 & (year==2012 | year==2017)
replace sldl="156" if sldlname=="5th Barnstable District" & fstate==25 & (year==2012 | year==2017)
replace sldl="157" if sldlname=="1st Norfolk District" & fstate==25 & (year==2012 | year==2017)
replace sldl="158" if sldlname=="2nd Norfolk District" & fstate==25 & (year==2012 | year==2017)
replace sldl="159" if sldlname=="3rd Norfolk District" & fstate==25 & (year==2012 | year==2017)
replace sldl="160" if sldlname=="4th Norfolk District" & fstate==25 & (year==2012 | year==2017)
replace sldl="161" if sldlname=="5th Norfolk District" & fstate==25 & (year==2012 | year==2017)
replace sldl="162" if sldlname=="6th Norfolk District" & fstate==25 & (year==2012 | year==2017)
replace sldl="163" if sldlname=="7th Norfolk District" & fstate==25 & (year==2012 | year==2017)
replace sldl="164" if sldlname=="8th Norfolk District" & fstate==25 & (year==2012 | year==2017)
replace sldl="165" if sldlname=="9th Norfolk District" & fstate==25 & (year==2012 | year==2017)
replace sldl="166" if sldlname=="10th Norfolk District" & fstate==25 & (year==2012 | year==2017)
replace sldl="167" if sldlname=="11th Norfolk District" & fstate==25 & (year==2012 | year==2017)
replace sldl="168" if sldlname=="12th Norfolk District" & fstate==25 & (year==2012 | year==2017)
replace sldl="169" if sldlname=="13th Norfolk District" & fstate==25 & (year==2012 | year==2017)
replace sldl="170" if sldlname=="14th Norfolk District" & fstate==25 & (year==2012 | year==2017)
replace sldl="171" if sldlname=="15th Norfolk District" & fstate==25 & (year==2012 | year==2017)
replace sldl="172" if sldlname=="1st Plymouth District" & fstate==25 & (year==2012 | year==2017)
replace sldl="173" if sldlname=="2nd Plymouth District" & fstate==25 & (year==2012 | year==2017)
replace sldl="174" if sldlname=="3rd Plymouth District" & fstate==25 & (year==2012 | year==2017)
replace sldl="175" if sldlname=="4th Plymouth District" & fstate==25 & (year==2012 | year==2017)
replace sldl="176" if sldlname=="5th Plymouth District" & fstate==25 & (year==2012 | year==2017)
replace sldl="177" if sldlname=="6th Plymouth District" & fstate==25 & (year==2012 | year==2017)
replace sldl="178" if sldlname=="7th Plymouth District" & fstate==25 & (year==2012 | year==2017)
replace sldl="179" if sldlname=="8th Plymouth District" & fstate==25 & (year==2012 | year==2017)
replace sldl="180" if sldlname=="9th Plymouth District" & fstate==25 & (year==2012 | year==2017)
replace sldl="181" if sldlname=="10th Plymouth District" & fstate==25 & (year==2012 | year==2017)
replace sldl="182" if sldlname=="11th Plymouth District" & fstate==25 & (year==2012 | year==2017)
replace sldl="183" if sldlname=="12th Plymouth District" & fstate==25 & (year==2012 | year==2017)
replace sldl="184" if sldlname=="1st Suffolk District" & fstate==25 & (year==2012 | year==2017)
replace sldl="185" if sldlname=="2nd Suffolk District" & fstate==25 & (year==2012 | year==2017)
replace sldl="186" if sldlname=="3rd Suffolk District" & fstate==25 & (year==2012 | year==2017)
replace sldl="187" if sldlname=="4th Suffolk District" & fstate==25 & (year==2012 | year==2017)
replace sldl="188" if sldlname=="5th Suffolk District" & fstate==25 & (year==2012 | year==2017)
replace sldl="189" if sldlname=="6th Suffolk District" & fstate==25 & (year==2012 | year==2017)
replace sldl="190" if sldlname=="7th Suffolk District" & fstate==25 & (year==2012 | year==2017)
replace sldl="191" if sldlname=="8th Suffolk District" & fstate==25 & (year==2012 | year==2017)
replace sldl="192" if sldlname=="9th Suffolk District" & fstate==25 & (year==2012 | year==2017)
replace sldl="193" if sldlname=="10th Suffolk District" & fstate==25 & (year==2012 | year==2017)
replace sldl="194" if sldlname=="11th Suffolk District" & fstate==25 & (year==2012 | year==2017)
replace sldl="195" if sldlname=="12th Suffolk District" & fstate==25 & (year==2012 | year==2017)
replace sldl="196" if sldlname=="13th Suffolk District" & fstate==25 & (year==2012 | year==2017)
replace sldl="197" if sldlname=="14th Suffolk District" & fstate==25 & (year==2012 | year==2017)
replace sldl="198" if sldlname=="15th Suffolk District" & fstate==25 & (year==2012 | year==2017)
replace sldl="199" if sldlname=="16th Suffolk District" & fstate==25 & (year==2012 | year==2017)
replace sldl="200" if sldlname=="17th Suffolk District" & fstate==25 & (year==2012 | year==2017)
replace sldl="201" if sldlname=="18th Suffolk District" & fstate==25 & (year==2012 | year==2017)
replace sldl="202" if sldlname=="19th Suffolk District" & fstate==25 & (year==2012 | year==2017)
replace sldl="203" if sldlname=="1st Worcester District" & fstate==25 & (year==2012 | year==2017)
replace sldl="204" if sldlname=="2nd Worcester District" & fstate==25 & (year==2012 | year==2017)
replace sldl="205" if sldlname=="3rd Worcester District" & fstate==25 & (year==2012 | year==2017)
replace sldl="206" if sldlname=="4th Worcester District" & fstate==25 & (year==2012 | year==2017)
replace sldl="207" if sldlname=="5th Worcester District" & fstate==25 & (year==2012 | year==2017)
replace sldl="208" if sldlname=="6th Worcester District" & fstate==25 & (year==2012 | year==2017)
replace sldl="209" if sldlname=="7th Worcester District" & fstate==25 & (year==2012 | year==2017)
replace sldl="210" if sldlname=="8th Worcester District" & fstate==25 & (year==2012 | year==2017)
replace sldl="211" if sldlname=="9th Worcester District" & fstate==25 & (year==2012 | year==2017)
replace sldl="212" if sldlname=="10th Worcester District" & fstate==25 & (year==2012 | year==2017)
replace sldl="213" if sldlname=="11th Worcester District" & fstate==25 & (year==2012 | year==2017)
replace sldl="214" if sldlname=="12th Worcester District" & fstate==25 & (year==2012 | year==2017)
replace sldl="215" if sldlname=="13th Worcester District" & fstate==25 & (year==2012 | year==2017)
replace sldl="216" if sldlname=="14th Worcester District" & fstate==25 & (year==2012 | year==2017)
replace sldl="217" if sldlname=="15th Worcester District" & fstate==25 & (year==2012 | year==2017)
replace sldl="218" if sldlname=="16th Worcester District" & fstate==25 & (year==2012 | year==2017)
replace sldl="219" if sldlname=="17th Worcester District" & fstate==25 & (year==2012 | year==2017)

replace sldl="1" if sldlname=="First Barnstable District" & fstate==25 & year==2007
replace sldl="2" if sldlname=="Second Barnstable District" & fstate==25 & year==2007
replace sldl="3" if sldlname=="Third Barnstable District" & fstate==25 & year==2007
replace sldl="4" if sldlname=="Fourth Barnstable District" & fstate==25 & year==2007
replace sldl="5" if sldlname=="Barnstable, Dukes & Nantucket District" & fstate==25 & year==2007
replace sldl="6" if sldlname=="First Berkshire District" & fstate==25 & year==2007
replace sldl="7" if sldlname=="Second Berkshire District" & fstate==25 & year==2007
replace sldl="8" if sldlname=="Third Berkshire District" & fstate==25 & year==2007
replace sldl="9" if sldlname=="Fourth Berkshire District" & fstate==25 & year==2007
replace sldl="10" if sldlname=="First Bristol District" & fstate==25 & year==2007
replace sldl="11" if sldlname=="Second Bristol District" & fstate==25 & year==2007
replace sldl="12" if sldlname=="Third Bristol District" & fstate==25 & year==2007
replace sldl="13" if sldlname=="Fourth Bristol District" & fstate==25 & year==2007
replace sldl="14" if sldlname=="Fifth Bristol District" & fstate==25 & year==2007
replace sldl="15" if sldlname=="Sixth Bristol District" & fstate==25 & year==2007
replace sldl="16" if sldlname=="Seventh Bristol District" & fstate==25 & year==2007
replace sldl="17" if sldlname=="Eighth Bristol District" & fstate==25 & year==2007
replace sldl="18" if sldlname=="Ninth Bristol District" & fstate==25 & year==2007
replace sldl="19" if sldlname=="Tenth Bristol District" & fstate==25 & year==2007
replace sldl="20" if sldlname=="Eleventh Bristol District" & fstate==25 & year==2007
replace sldl="21" if sldlname=="Twelfth Bristol District" & fstate==25 & year==2007
replace sldl="22" if sldlname=="Thirteenth Bristol District" & fstate==25 & year==2007
replace sldl="23" if sldlname=="Fourteenth Bristol District" & fstate==25 & year==2007
replace sldl="24" if sldlname=="First Essex District" & fstate==25 & year==2007
replace sldl="25" if sldlname=="Second Essex District" & fstate==25 & year==2007
replace sldl="26" if sldlname=="Third Essex District" & fstate==25 & year==2007
replace sldl="27" if sldlname=="Fourth Essex District" & fstate==25 & year==2007
replace sldl="28" if sldlname=="Fifth Essex District" & fstate==25 & year==2007
replace sldl="29" if sldlname=="Sixth Essex District" & fstate==25 & year==2007
replace sldl="30" if sldlname=="Seventh Essex District" & fstate==25 & year==2007
replace sldl="31" if sldlname=="Eighth Essex District" & fstate==25 & year==2007
replace sldl="32" if sldlname=="Ninth Essex District" & fstate==25 & year==2007
replace sldl="33" if sldlname=="Tenth Essex District" & fstate==25 & year==2007
replace sldl="34" if sldlname=="Eleventh Essex District" & fstate==25 & year==2007
replace sldl="35" if sldlname=="Twelfth Essex District" & fstate==25 & year==2007
replace sldl="36" if sldlname=="Thirteenth Essex District" & fstate==25 & year==2007
replace sldl="37" if sldlname=="Fourteenth Essex District" & fstate==25 & year==2007
replace sldl="38" if sldlname=="Fifteenth Essex District" & fstate==25 & year==2007
replace sldl="39" if sldlname=="Sixteenth Essex District" & fstate==25 & year==2007
replace sldl="40" if sldlname=="Seventeenth Essex District" & fstate==25 & year==2007
replace sldl="41" if sldlname=="First Franklin District" & fstate==25 & year==2007
replace sldl="42" if sldlname=="Second Franklin District" & fstate==25 & year==2007
replace sldl="43" if sldlname=="First Hampden District" & fstate==25 & year==2007
replace sldl="44" if sldlname=="Second Hampden District" & fstate==25 & year==2007
replace sldl="45" if sldlname=="Third Hampden District" & fstate==25 & year==2007
replace sldl="46" if sldlname=="Fourth Hampden District" & fstate==25 & year==2007
replace sldl="47" if sldlname=="Fifth Hampden District" & fstate==25 & year==2007
replace sldl="48" if sldlname=="Sixth Hampden District" & fstate==25 & year==2007
replace sldl="49" if sldlname=="Seventh Hampden District" & fstate==25 & year==2007
replace sldl="50" if sldlname=="Eighth Hampden District" & fstate==25 & year==2007
replace sldl="51" if sldlname=="Ninth Hampden District" & fstate==25 & year==2007
replace sldl="52" if sldlname=="Tenth Hampden District" & fstate==25 & year==2007
replace sldl="53" if sldlname=="Eleventh Hampden District" & fstate==25 & year==2007
replace sldl="54" if sldlname=="Twelfth Hampden District" & fstate==25 & year==2007
replace sldl="55" if sldlname=="Eighteenth Essex District" & fstate==25 & year==2007
replace sldl="56" if sldlname=="First Hampshire District" & fstate==25 & year==2007
replace sldl="57" if sldlname=="Second Hampshire District" & fstate==25 & year==2007
replace sldl="58" if sldlname=="Third Hampshire District" & fstate==25 & year==2007
replace sldl="59" if sldlname=="First Middlesex District" & fstate==25 & year==2007
replace sldl="60" if sldlname=="Second Middlesex District" & fstate==25 & year==2007
replace sldl="61" if sldlname=="Third Middlesex District" & fstate==25 & year==2007
replace sldl="62" if sldlname=="Fourth Middlesex District" & fstate==25 & year==2007
replace sldl="63" if sldlname=="Fifth Middlesex District" & fstate==25 & year==2007
replace sldl="64" if sldlname=="Sixth Middlesex District" & fstate==25 & year==2007
replace sldl="65" if sldlname=="Seventh Middlesex District" & fstate==25 & year==2007
replace sldl="66" if sldlname=="Eighth Middlesex District" & fstate==25 & year==2007
replace sldl="67" if sldlname=="Ninth Middlesex District" & fstate==25 & year==2007
replace sldl="68" if sldlname=="Tenth Middlesex District" & fstate==25 & year==2007
replace sldl="69" if sldlname=="Eleventh Middlesex District" & fstate==25 & year==2007
replace sldl="70" if sldlname=="Twelfth Middlesex District" & fstate==25 & year==2007
replace sldl="71" if sldlname=="Thirteenth Middlesex District" & fstate==25 & year==2007
replace sldl="72" if sldlname=="Fourteenth Middlesex District" & fstate==25 & year==2007
replace sldl="73" if sldlname=="Fifteenth Middlesex District" & fstate==25 & year==2007
replace sldl="74" if sldlname=="Sixteenth Middlesex District" & fstate==25 & year==2007
replace sldl="75" if sldlname=="Seventeenth Middlesex District" & fstate==25 & year==2007
replace sldl="76" if sldlname=="Eighteenth Middlesex District" & fstate==25 & year==2007
replace sldl="77" if sldlname=="Nineteenth Middlesex District" & fstate==25 & year==2007
replace sldl="78" if sldlname=="Twentieth Middlesex District" & fstate==25 & year==2007
replace sldl="79" if sldlname=="Twenty-First Middlesex District" & fstate==25 & year==2007
replace sldl="80" if sldlname=="Twenty-Second Middlesex District" & fstate==25 & year==2007
replace sldl="81" if sldlname=="Twenty-Third Middlesex District" & fstate==25 & year==2007
replace sldl="82" if sldlname=="Twenty-Fourth Middlesex District" & fstate==25 & year==2007
replace sldl="83" if sldlname=="Twenty-Fifth Middlesex District" & fstate==25 & year==2007
replace sldl="84" if sldlname=="Twenty-Sixth Middlesex District" & fstate==25 & year==2007
replace sldl="85" if sldlname=="Twenty-Seventh Middlesex District" & fstate==25 & year==2007
replace sldl="86" if sldlname=="Twenty-Eighth Middlesex District" & fstate==25 & year==2007
replace sldl="87" if sldlname=="Twenty-Ninth Middlesex District" & fstate==25 & year==2007
replace sldl="88" if sldlname=="Thirtieth Middlesex District" & fstate==25 & year==2007
replace sldl="89" if sldlname=="Thirty-First Middlesex District" & fstate==25 & year==2007
replace sldl="90" if sldlname=="Thirty-Second Middlesex District" & fstate==25 & year==2007
replace sldl="91" if sldlname=="Thirty-Third Middlesex District" & fstate==25 & year==2007
replace sldl="92" if sldlname=="Thirty-Fourth Middlesex District" & fstate==25 & year==2007
replace sldl="93" if sldlname=="Thirty-Fifth Middlesex District" & fstate==25 & year==2007
replace sldl="94" if sldlname=="Thirty-Sixth Middlesex District" & fstate==25 & year==2007
replace sldl="95" if sldlname=="Thirty-Seventh Middlesex District" & fstate==25 & year==2007
replace sldl="96" if sldlname=="Eighteenth Worcester District" & fstate==25 & year==2007
replace sldl="97" if sldlname=="Fifth Barnstable District" & fstate==25 & year==2007
replace sldl="98" if sldlname=="First Norfolk District" & fstate==25 & year==2007
replace sldl="99" if sldlname=="Second Norfolk District" & fstate==25 & year==2007
replace sldl="100" if sldlname=="Third Norfolk District" & fstate==25 & year==2007
replace sldl="101" if sldlname=="Fourth Norfolk District" & fstate==25 & year==2007
replace sldl="102" if sldlname=="Fifth Norfolk District" & fstate==25 & year==2007
replace sldl="103" if sldlname=="Sixth Norfolk District" & fstate==25 & year==2007
replace sldl="104" if sldlname=="Seventh Norfolk District" & fstate==25 & year==2007
replace sldl="105" if sldlname=="Eighth Norfolk District" & fstate==25 & year==2007
replace sldl="106" if sldlname=="Ninth Norfolk District" & fstate==25 & year==2007
replace sldl="107" if sldlname=="Tenth Norfolk District" & fstate==25 & year==2007
replace sldl="108" if sldlname=="Eleventh Norfolk District" & fstate==25 & year==2007
replace sldl="109" if sldlname=="Twelfth Norfolk District" & fstate==25 & year==2007
replace sldl="110" if sldlname=="Thirteenth Norfolk District" & fstate==25 & year==2007
replace sldl="111" if sldlname=="Fourteenth Norfolk District" & fstate==25 & year==2007
replace sldl="112" if sldlname=="Fifteenth Norfolk District" & fstate==25 & year==2007
replace sldl="113" if sldlname=="First Plymouth District" & fstate==25 & year==2007
replace sldl="114" if sldlname=="Second Plymouth District" & fstate==25 & year==2007
replace sldl="115" if sldlname=="Third Plymouth District" & fstate==25 & year==2007
replace sldl="116" if sldlname=="Fourth Plymouth District" & fstate==25 & year==2007
replace sldl="117" if sldlname=="Fifth Plymouth District" & fstate==25 & year==2007
replace sldl="118" if sldlname=="Sixth Plymouth District" & fstate==25 & year==2007
replace sldl="119" if sldlname=="Seventh Plymouth District" & fstate==25 & year==2007
replace sldl="120" if sldlname=="Eighth Plymouth District" & fstate==25 & year==2007
replace sldl="121" if sldlname=="Ninth Plymouth District" & fstate==25 & year==2007
replace sldl="122" if sldlname=="Tenth Plymouth District" & fstate==25 & year==2007
replace sldl="123" if sldlname=="Eleventh Plymouth District" & fstate==25 & year==2007
replace sldl="124" if sldlname=="Twelfth Plymouth District" & fstate==25 & year==2007
replace sldl="125" if sldlname=="First Suffolk District" & fstate==25 & year==2007
replace sldl="126" if sldlname=="Second Suffolk District" & fstate==25 & year==2007
replace sldl="127" if sldlname=="Third Suffolk District" & fstate==25 & year==2007
replace sldl="128" if sldlname=="Fourth Suffolk District" & fstate==25 & year==2007
replace sldl="129" if sldlname=="Fifth Suffolk District" & fstate==25 & year==2007
replace sldl="130" if sldlname=="Sixth Suffolk District" & fstate==25 & year==2007
replace sldl="131" if sldlname=="Seventh Suffolk District" & fstate==25 & year==2007
replace sldl="132" if sldlname=="Eighth Suffolk District" & fstate==25 & year==2007
replace sldl="133" if sldlname=="Ninth Suffolk District" & fstate==25 & year==2007
replace sldl="134" if sldlname=="Tenth Suffolk District" & fstate==25 & year==2007
replace sldl="135" if sldlname=="Eleventh Suffolk District" & fstate==25 & year==2007
replace sldl="136" if sldlname=="Twelfth Suffolk District" & fstate==25 & year==2007
replace sldl="137" if sldlname=="Thirteenth Suffolk District" & fstate==25 & year==2007
replace sldl="138" if sldlname=="Fourteenth Suffolk District" & fstate==25 & year==2007
replace sldl="139" if sldlname=="Fifteenth Suffolk District" & fstate==25 & year==2007
replace sldl="140" if sldlname=="Sixteenth Suffolk District" & fstate==25 & year==2007
replace sldl="141" if sldlname=="Seventeenth Suffolk District" & fstate==25 & year==2007
replace sldl="142" if sldlname=="Eighteenth Suffolk District" & fstate==25 & year==2007
replace sldl="143" if sldlname=="Nineteenth Suffolk District" & fstate==25 & year==2007
replace sldl="144" if sldlname=="First Worcester District" & fstate==25 & year==2007
replace sldl="145" if sldlname=="Second Worcester District" & fstate==25 & year==2007
replace sldl="146" if sldlname=="Third Worcester District" & fstate==25 & year==2007
replace sldl="147" if sldlname=="Fourth Worcester District" & fstate==25 & year==2007
replace sldl="148" if sldlname=="Fifth Worcester District" & fstate==25 & year==2007
replace sldl="149" if sldlname=="Sixth Worcester District" & fstate==25 & year==2007
replace sldl="150" if sldlname=="Seventh Worcester District" & fstate==25 & year==2007
replace sldl="151" if sldlname=="Eighth Worcester District" & fstate==25 & year==2007
replace sldl="152" if sldlname=="Ninth Worcester District" & fstate==25 & year==2007
replace sldl="153" if sldlname=="Tenth Worcester District" & fstate==25 & year==2007
replace sldl="154" if sldlname=="Eleventh Worcester District" & fstate==25 & year==2007
replace sldl="155" if sldlname=="Twelfth Worcester District" & fstate==25 & year==2007
replace sldl="156" if sldlname=="Thirteenth Worcester District" & fstate==25 & year==2007
replace sldl="157" if sldlname=="Fourteenth Worcester District" & fstate==25 & year==2007
replace sldl="158" if sldlname=="Fifteenth Worcester District" & fstate==25 & year==2007
replace sldl="159" if sldlname=="Sixteenth Worcester District" & fstate==25 & year==2007
replace sldl="160" if sldlname=="Seventeenth Worcester District" & fstate==25 & year==2007
